//////////////////////////////////////////////////////////////////////////
//
// GAM203
// Sound Emitter
// SoundEmitter.h
// 
// Scott Taylor
// Qantm College
//
//////////////////////////////////////////////////////////////////////////

#ifndef SOUNDEMITTER_H
#define SOUNDEMITTER_H

class SoundSample;

class SoundEmitter
{
public:
  SoundEmitter(SoundSample* a_pSample);
  virtual ~SoundEmitter();

  void Update();

  bool Play();
  bool PlayLooping();
  bool Pause();
  bool Unpause();
  bool IsPaused();
  bool Stop();

  bool SetPosition(float a_posX, float a_posY, float a_posZ);  // Sets position for 3D sounds in world space

  bool SetVolume(float a_volume);  // Volume range 0..1

  void DestroyOnStop() { m_destroyOnStop = true; }  // Auto-delete this emitter when it finishes playing

  bool IsPlaying() const { return m_isPlaying; }
  bool IsDestroyOnStop() const { return m_destroyOnStop; }  // Whether this emitter should be auto-deleted when it finishes

  SoundSample* GetSample() { return m_pSample; }

private:
  int m_channel;

  bool m_isPlaying;
  bool m_destroyOnStop;  // Whether emitter should be automatically destroyed when its sound ends

  SoundSample* m_pSample;
  int m_errorCode;
};

#endif  // SOUNDEMITTER_H

